# -*- encoding=utf8 -*-
"""
RedFlag-TC000013  	准备测试视频
准备测试视频素材
"""
__author__ = "ldm"

import sys
import os
# 获取当前脚本所在目录.py
current_dir = os.path.dirname(os.path.abspath(__file__))
# 获取上级目录.air
parent_dir = os.path.dirname(current_dir)
# 获取上级目录air
grandparent_dir = os.path.dirname(parent_dir)
# 获取和air目录平级的conf、testcase目录路径
conf_dir = os.path.join(grandparent_dir, 'conf')
testcase_dir = os.path.join(grandparent_dir, 'testcase')
# 将conf、testcase目录添加到sys.path
sys.path.append(conf_dir)
sys.path.append(testcase_dir)

from PageFunction import CameraVideoShooter
from elements import *
from device_elements import *
auto_setup(__file__)

shooter = CameraVideoShooter()

log("-----------------------------------------------准备测试视频素材-------------------------------------------------")
# 获取手机品牌
phone_model = shooter.get_phone_model()
"""
拍摄顺序
1.拍摄一张照片
2.拍摄7S的高帧率视频
3.拍摄大于300S的高帧率视频 
4.拍摄大于300S的高帧率视频
5.拍摄7S的低帧率视频拍摄
6.拍摄大于300S的低帧率视频
7.拍摄大于300S的低帧率视频
"""
#判断调用方法
if phone_model:
    if "huawei" in phone_model.lower() or "华为" in phone_model:
        shooter.local_camera_takes_photos_hauweiP50()
        shooter.local_camera_captures_videos_huaweiP50("60 fps", "4K", 7, open_camera=True, close_camera=False)
        shooter.local_camera_captures_videos_huaweiP50("60 fps", "4K", 300, open_camera=False, close_camera=False)
        shooter.local_camera_captures_videos_huaweiP50("60 fps", "4K", 300, open_camera=False, close_camera=False)
        shooter.local_camera_captures_videos_huaweiP50("30 fps", "720p", 7, open_camera=False, close_camera=False)
        shooter.local_camera_captures_videos_huaweiP50("30 fps", "720p", 300,open_camera=False, close_camera=False)
        shooter.local_camera_captures_videos_huaweiP50("30 fps", "720p", 300, open_camera=False, close_camera=True)
    elif "vivo" in phone_model.lower():
        shooter.local_camera_takes_photos_vivoS7()
        shooter.set_and_capture_video_vivoS7(fps_show_60_vivo, size_show_4K_vivo, 7)
        shooter.set_and_capture_video_vivoS7(fps_show_60_vivo, size_show_4K_vivo, 300)
        shooter.set_and_capture_video_vivoS7(fps_show_60_vivo, size_show_4K_vivo, 300)
        shooter.set_and_capture_video_vivoS7(fps_show_30_vivo, size_show_720p_vivo, 10)
        shooter.set_and_capture_video_vivoS7(fps_show_30_vivo, size_show_720p_vivo, 300)
        shooter.set_and_capture_video_vivoS7(fps_show_30_vivo, size_show_720p_vivo, 300)
    else:
        print(f"不支持的手机品牌: {phone_model}")
else:
    print("无法获取手机型号信息，跳过拍摄操作")
